package org.budo.netty.servlet.server.session.repository;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

/**
 * @author li
 */
public class MapSessionRepository extends AbstractSessionRepository {
    private Map<String, HttpSession> sessionMap = new HashMap<String, HttpSession>();

    @Override
    public HttpSession findById(String id) {
        return this.sessionMap.get(id);
    }

    @Override
    public void saveSession(HttpSession session) {
        this.sessionMap.put(session.getId(), session);
    }

    @Override
    public void deleteById(String id) {
        this.sessionMap.remove(id);
    }
}
